package information;

import com.alibaba.fastjson.JSONObject;

/**
 * @author 司啸飞
 * @create 2021-05-17 10:35
 */
public class UpInformation {

    private static UpInformation upInformation;

    private JSONObject jsonObject;

    /**
     * 懒汉模式
     * @return
     */
    public static UpInformation getUpInformation(){
        if (upInformation == null) {
            upInformation = new UpInformation();
        }
        return upInformation;
    }

    /**
     * 获取对象内key对应的value数值
     * @param key
     * @return
     */
    public String getJsonObject(String key){
        String json = jsonObject.getString(key);
        return json;
    }

    /**
     * 传入一个JSONObject对象将数值全部添加进json对象
     * @param jo
     */
    public void setJsonObjectAll(JSONObject jo){
        jsonObject.putAll(jo);
    }

    /**
     * 无参构造,创建new JSONObject对象
     */
    public UpInformation(){
        jsonObject = new JSONObject();
    }


}
